DEFINITION MODULE RcMgr;

(*
Rectangle Manager.

UK __DATE__ __TIME__
*)

(*DEF_SWITCHES*)

FROM PORTAB IMPORT SIGNEDWORD,UNSIGNEDWORD;

#if export
EXPORT QUALIFIED GPnt,GRect,ORectPtr,ORect,
                 Min,Max,RcIntersect,RcUnion,RcConstrain,RcEqual,RcCopy,
                 RcInside,RcSnap,XYWHToGRect;
#endif

TYPE GPnt = RECORD
              GX: SIGNEDWORD;
              GY: SIGNEDWORD;
            END;

     GRect = RECORD
               GX: SIGNEDWORD;
               GY: SIGNEDWORD;
               GW: SIGNEDWORD;
               GH: SIGNEDWORD;
             END;

     ORectPtr = POINTER TO ORect;
     ORect = RECORD
               OLink: ORectPtr;
               OX   : SIGNEDWORD;
               OY   : SIGNEDWORD;
               OW   : SIGNEDWORD;
               OH   : SIGNEDWORD;
             END;

PROCEDURE Min(a,b: SIGNEDWORD): SIGNEDWORD;

PROCEDURE Max(a,b: SIGNEDWORD): SIGNEDWORD;

PROCEDURE RcIntersect(VAR R1,R2: GRect): BOOLEAN;

PROCEDURE RcUnion(VAR R1,R2: GRect);

PROCEDURE RcConstrain(R1: GRect; VAR R2: GRect);

PROCEDURE RcEqual(VAR R1,R2: GRect): BOOLEAN;

PROCEDURE RcCopy(VAR From,To: GRect);

PROCEDURE RcInside(P: GPnt; VAR R: GRect): BOOLEAN;

PROCEDURE RcSnap(X: SIGNEDWORD; N: UNSIGNEDWORD): SIGNEDWORD;

PROCEDURE XYWHToGRect(    X,Y,W,H: SIGNEDWORD;
                      VAR Rect   : GRect);

END RcMgr.
